﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Data;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
   public class SystemInfo
    {
        private int _ID;
          [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
          private int _MenuId;
         [DataMember]
          public int MenuId
          {
              get { return _MenuId; }
              set { _MenuId = value; }
          }
          private string _MoKuai;
         [DataMember]
          public string MoKuai
          {
              get { return _MoKuai; }
              set { _MoKuai = value; }
          }
          private string _MoKuaiSX;
         [DataMember]
          public string MoKuaiSX
          {
              get { return _MoKuaiSX; }
              set { _MoKuaiSX = value; }
          }
          private string DW;
         [DataMember]
          public string DW1
          {
              get { return DW; }
              set { DW = value; }
          }
          private string Status;
         [DataMember]
          public string Status1
          {
              get { return Status; }
              set { Status = value; }
          }
          private string _ChaKanSJ;
         [DataMember]
          public string ChaKanSJ
          {
              get { return _ChaKanSJ; }
              set { _ChaKanSJ = value; }
          }
          private string _CreateUser;
         [DataMember]
          public string CreateUser
          {
              get { return _CreateUser; }
              set { _CreateUser = value; }
          }
          private string _CreateDate;
         [DataMember]
          public string CreateDate
          {
              get { return _CreateDate; }
              set { _CreateDate = value; }
          }

         private int _CreateUserID;
        [DataMember]
         public int CreateUserID
         {
             get { return _CreateUserID; }
             set { _CreateUserID = value; }
         }
        private string _OrgIDs;
        [DataMember]
        public string OrgIDs
         {
             get { return _OrgIDs; }
             set { _OrgIDs = value; }
         }
        private int _LogUID;
        [DataMember]
           public int LogUID
         {
             get { return _LogUID; }
             set { _LogUID = value; }
         }
        
         public static SystemInfo FillEntity(DataRow dr)
         {
             SystemInfo sys = new SystemInfo();
             if (dr.Table != null && dr.Table.Columns.Contains("ID") && !string.IsNullOrEmpty(dr["ID"].ToString())) sys.ID = Convert.ToInt32(dr["ID"].ToString());
             if (dr.Table != null && dr.Table.Columns.Contains("MenuId") && !string.IsNullOrEmpty(dr["MenuId"].ToString())) sys.MenuId = Convert.ToInt32(dr["MenuId"].ToString());
             if (dr.Table != null && dr.Table.Columns.Contains("MoKuai") && !string.IsNullOrEmpty(dr["MoKuai"].ToString())) sys.MoKuai = dr["MoKuai"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("MoKuaiSX") && !string.IsNullOrEmpty(dr["MoKuaiSX"].ToString())) sys.MoKuaiSX = dr["MoKuaiSX"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("DW") && !string.IsNullOrEmpty(dr["DW"].ToString())) sys.DW1 = dr["DW"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("Status") && !string.IsNullOrEmpty(dr["Status"].ToString())) sys.Status1 = Convert.ToBoolean(dr["Status"].ToString()) == true ? "已查看" : "未查看";
             if (dr.Table != null && dr.Table.Columns.Contains("ChaKanSJ") && !string.IsNullOrEmpty(dr["ChaKanSJ"].ToString())) sys.ChaKanSJ = Convert.ToDateTime(dr["ChaKanSJ"].ToString()).ToString("yyyy-MM-dd");
             if (dr.Table != null && dr.Table.Columns.Contains("CreateDate") && !string.IsNullOrEmpty(dr["CreateDate"].ToString())) sys.CreateDate = Convert.ToDateTime(dr["CreateDate"].ToString()).ToString("yyyy-MM-dd");
             if (dr.Table != null && dr.Table.Columns.Contains("CreateUser") && !string.IsNullOrEmpty(dr["CreateUser"].ToString())) sys.CreateUser = dr["CreateUser"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("CreateUserID") && !string.IsNullOrEmpty(dr["CreateUserID"].ToString())) sys.ID = Convert.ToInt32(dr["CreateUserID"].ToString());
             if (dr.Table != null && dr.Table.Columns.Contains("OrgIDs") && !string.IsNullOrEmpty(dr["OrgIDs"].ToString())) sys.OrgIDs =dr["OrgIDs"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("LogUID") && !string.IsNullOrEmpty(dr["LogUID"].ToString())) sys.LogUID = Convert.ToInt32(dr["LogUID"].ToString());
             return sys;
         }
    }
}
